<?php
class Inc_Form_Contact extends Zend_Form
{
	public function init()
	{
		$this->setAction('/contact/index');
		$this->setMethod('post');

		$this->addElement('text', 'name', array(
				'label' => 'Name:',
				'size' => 35,
				'required' => true,
				'validator' => array('NotEmpty', 'Alpha'),
				'filter' => array('HtmlEntities', 'StringTrim'),
		));
		 
			
		// text field email address
		$this->addElement('text', 'email', array(
				'label' => 'Email address:',
				'size' => '35',
				'required' => true,
				'validators' => array('NotEmpty', 'EmailAddress'),
				'filter' => array('HtmlEntities', 'StringTolower', 'StringTrim')
		));
		
		// text area for messages
		$this->addElement('textarea', 'message', array(
				'label' => 'Message:',
				'rows' => '10',
				'cols' => '50',
				'required' => true,
				'validator' => 'NotEmpty',
				'addFilters' => array('HtmlEntities', 'StringTrim')
		));
		
		// captcha
		$this->addElement('captcha', 'captcha', array(
						'label' => 'Verification code:',
						'captcha' => array(
						
								'captcha' => 'Image',
								'wordLen' => 3,
								'timeOut' => 300,
								'width' => 150,
								'height' => 80,
								'imgUrl' => '/captcha',
								'imgDir' => APPLICATION_PATH. '/../public/captcha',
								'font' => APPLICATION_PATH. '/../public/fonts/LiberationSans-Regular.ttf'
							)
				));
			
		// add group
		$this->addDisplayGroup(
				array('name', 'email', 'message', 'captcha'), 'contact');		
		
		$this->getDisplayGroup('contact')
		->setLegend('Contact information');
		
		// button submit
		$this->addElement('submit', 'submit', array(
				'label' => 'send',
		));
	
	}
}